<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li{
      width: 500px;
      height: 80px;
      background-color: pink;
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="item in arr">
        {{ item }}
      </li>
    </ul>
    <hr>
    <ul>
      <li v-for="(item,index) in arr" @click="removeLi(index)">
        {{ item }} 
        => 
        {{ index }}
      </li>
    </ul>
    <hr>
    <ul>
      <li v-for="item in json">
        {{ item }}
      </li>
    </ul>
    <hr>
    <ul>
      <li v-for="(item,key,index) in json">
        {{key}}
        =>
        {{index}}
        =>
        {{ item }}

      </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script>

    const vm = new Vue({
      el: '#app',
      data: {
        arr: [1,2,3,4],
        json: {
          name:'小明',
          age: 18,
          gender: "男" // 0 男 
        }
      },
      methods: {
        removeLi(i){
          this.arr.splice(i, 1);
        }
      }
    })
    // btn.addEventListener('事件',回调函数,[false/true])
  </script>
</body>
</html>